package com.example.leetdemo.finash;

public class Solution2396 {


    public boolean isStrictlyPalindromic(int n) {


        for (int i = 2; i < n - 1; i++) {
            StringBuilder builder = new StringBuilder();
            int temp = n;
            while (temp > 0) {
                builder.append(temp % i);
                temp = temp / i;
            }
            if (!isPalindromic(builder.toString())) {
                return false;
            }
        }
        return true;
    }

    private boolean isPalindromic(String str) {
        for (int i = 0; i < str.length() / 2; i++) {
            if (str.charAt(i) != str.charAt(str.length() - 1 - i)) {
                return false;
            }
        }
        return true;
    }


    public static void main(String[] args) {
        Solution2396 solution2396 = new Solution2396();
        System.err.println(solution2396.isStrictlyPalindromic(9));
    }
}
